<template>
  <!-- 查看详情 2018/3/7 11:44 zhangQ -->
  <div>

    <tablePage ref="inspectionTab" :api="getSubOrderListFleet" :param="tabParam" :isStartLoad="true">
      <template slot-scope="props">
        <Table :columns="columns" :data="props.data" @on-sort-change="props.sortChange" border></Table>
      </template>
    </tablePage>
  </div>
</template>

<script>
  import {getSubOrderListFleet} from '@api/backEnd/fetchingBusiness/index'
  import xlinkModal from '@components/modal/xlinkModal'
  import tablePage from '@components/table/tablePage.vue'
  import moment from 'moment'

  export default {
    name: 'view-detail',
    data () {
      let tabParam = {
        pickupId: this.currentMainOrder.id
      }
      let columns = [
        {
          title: '司机姓名',
          ellipsis: 'true',
          key: 'driverName',
          width: 200
        },
        {
          title: '绑箱重量',
          ellipsis: 'true',
          key: 'bindWeight',
          width: 150
        },
        {
          title: '指派车队',
          ellipsis: 'true',
          width: 180,
          key: 'dispatchOrgName'
        },
        {
          title: '状态',
          ellipsis: 'true',
          width: 120,
          key: 'state',
          render: (h, params) => {
            let thisdata = params.row.state
            let thisShow = ''
            if (+thisdata === 0) {
              thisShow = '待确认'
            } else if (+thisdata === 1) {
              thisShow = '确认'
            } else if (+thisdata === 2) {
              thisShow = '取消'
            }
            return (<span>{thisShow}</span>)
          }
        },
        {
          title: '绑定时间',
          ellipsis: 'true',
          width: 200,
          key: 'createTime',
          render: (h, params) => {
            let thisdata = params.row.createTime
            thisdata = thisdata ? moment(thisdata).format('YYYY-MM-DD HH:mm') : ''
            return (<span>{thisdata}</span>)
          }
        }
      ]
      let datas = {
        getSubOrderListFleet,
        columns,
        tabParam
      }
      return datas
    },
    props: {
      currentMainOrder: {
        type: Object,
        default () {
          return {}
        }
      }
    },
    computed: {},
    methods: {},
    mounted () {
    },
    components: {tablePage, xlinkModal}
  }
</script>
